#ifndef nutritionalinfo_h
#define nutritionalinfo_h

#include <iostream>
#include <fstream>
#include <string>

using std::fstream;
using std::string;

class NutritionalInfo
{
public:
	float servingSize;
	float calories;

	float sodium;
	float totalFat;
	float transFat;
	float saturatedFat;
	float cholesterol;

	float totalCarb;
	float sugar;
	float fibre;

	float protein;

	float alcohol;

	float vitaminA;
	float vitaminC;
	float vitaminD;
	float calcium;
	float iron;

	float thiamin;
	float phosphorus;
	float zinc;

	float caffeine;
	float potassium;

	void calculateCalories() {
		calories = 4.f * (totalCarb - fibre) + 4.f * protein + 9.f * totalFat + 7.f * alcohol;
	}

	NutritionalInfo() :
		calories(0), sodium(0), totalFat(0), transFat(0), saturatedFat(0), cholesterol(0), totalCarb(0),
				sugar(0), fibre(0), protein(0), alcohol(0), vitaminA(0), vitaminC(0), vitaminD(0), calcium(0), iron(0)
	{
	}

	void operator=(const NutritionalInfo& other)
	{
		this->sodium = other.sodium;
		this->totalFat = other.totalFat;
		this->transFat = other.transFat;
		this->saturatedFat = other.saturatedFat;
		this->cholesterol = other.cholesterol;

		this->totalCarb = other.totalCarb;
		this->sugar = other.sugar;
		this->fibre = other.fibre;

		this->protein = other.protein;
		this->vitaminA = other.vitaminA;
		this->vitaminC = other.vitaminC;
		this->vitaminD = other.vitaminD;
		this->calcium = other.calcium;
		this->iron = other.iron;
		this->calories = other.calories;
		this->caffeine = other.caffeine;
		this->potassium = other.potassium;
	}

	void operator+=(const NutritionalInfo& other) {
		this->calories += other.calories;

		this->totalFat += other.totalFat;
		this->saturatedFat += other.saturatedFat;
		this->transFat += other.transFat;
		this->cholesterol += other.cholesterol;
		this->sodium += other.sodium;

		this->totalCarb += other.totalCarb;
		this->fibre += other.fibre;
		this->sugar += other.sugar;

		this->protein += other.protein;

		this->alcohol += other.alcohol;

		this->vitaminA += other.vitaminA;
		this->vitaminC += other.vitaminC;
		this->vitaminD += other.vitaminD;
		this->calcium += other.calcium;
		this->iron += other.iron;

		this->thiamin += other.thiamin;
		this->phosphorus += other.phosphorus;
		this->zinc += other.zinc;

		this->caffeine += other.caffeine;
		this->potassium += other.potassium;
	}

	void operator*=(float factor) {
		this->calories *= factor;

		this->totalFat *= factor;
		this->saturatedFat *= factor;
		this->transFat *= factor;
		this->cholesterol *= factor;
		this->sodium *= factor;

		this->totalCarb *= factor;
		this->fibre *= factor;
		this->sugar *= factor;

		this->protein *= factor;

		this->alcohol *= factor;

		this->vitaminA *= factor;
		this->vitaminC *= factor;
		this->vitaminD *= factor;
		this->calcium *= factor;
		this->iron *= factor;

		this->thiamin *= factor;
		this->phosphorus *= factor;
		this->zinc *= factor;

		this->caffeine *= factor;
		this->potassium *= factor;
	}
};

#endif
